﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Xml.Serialization;

namespace HYQuick
{
    public class HYQuickMethod
    {
        public String MethodName = "打开资源管理器";
        public String MethodScript = "Call(\"explorer.exe\",\"\")";  //script:脚本
        public String MethodDescription = "打开资源管理器";
        public String MethodParamRegex = @""; // 可接参数的正则表达式匹配，如\d表示任意数字，.表示任意字符，+表示一个或多个，*表示0个或多个
        public String MethodDefArgs = "";//动作执行的默认参数，用逗号分隔开
        public Int32 MethodPriority = 0;//方法优先权
        [XmlIgnore]
        public String Application = "";
        public override string ToString()
        {
            return Regex.Replace(MethodName, @"\[.*?\]|\{|\}", "");//替换与正则表达式相符的字符串
        }

        public void SetAdditionMethod(IHYQuickPluginMethod method)
        {
            m_method = method;
        }

        public IHYQuickPluginMethod GetPluginInterface()
        {
            if (m_method == null)
                return null;
            return new HYQuickSafePluginMethodRef(m_method);//仍然存疑
        }

        private IHYQuickPluginMethod m_method;
    }
}
